package com.dlc.felear.xiaoensale.utils;

import android.util.Log;

import com.dlc.felear.xiaoensale.constant.Constant;
import com.dlc.felear.xiaoensale.entity.Operator;
import com.dlc.felear.xiaoensale.factory.CmdList;
import com.dlc.felear.xiaoensale.helper.JsonHelper;
import com.dlc.felear.xiaoensale.helper.Session;

public class OperatorToCmd {
    private static final String TAG = "OperatorToCmd";

//    public static byte[] getCmdByOperator(Session session, Operator operator) {
//        Log.e(TAG,"operator="+JsonHelper.toJson(operator));
//        byte[] data = null;
//        switch (operator.getName()) {
//            case Constant.ACTION_NAME_LIAOJIU:
//            case Constant.ACTION_NAME_CU:
//            case Constant.ACTION_NAME_SHENGCHOU:
//            case Constant.ACTION_NAME_LAOCHOU:
//            case Constant.ACTION_NAME_YOU:
//            case Constant.ACTION_NAME_XIANGYOU:
//            case Constant.ACTION_NAME_HAOYOU:
//            case Constant.ACTION_NAME_SHUI:
//                //加液体 料酒 醋 生抽 老抽 油 香油 蚝油 水
//                Log.e(TAG, "name=" + operator.getName() + " ml=" + mlVavluechangeTime(session, operator.getName(), operator.getValue1()));
//                if (operator.getValue() <= 7 && operator.getValue() >= 0) {
//                    data = CmdList.actionJyt(operator.getValue(),
//                            mlVavluechangeTime(session, operator.getName(), operator.getValue1()));
//                }
//                break;
//            case Constant.ACTION_NAME_Y:
//            case Constant.ACTION_NAME_JJ:
//            case Constant.ACTION_NAME_HJF:
//            case Constant.ACTION_NAME_T:
//                //加固体 盐 鸡精 胡椒粉 糖
//                if (operator.getValue() <= 4 && operator.getValue() >= 0) {
//                    data = CmdList.actionJgt(operator.getValue(),
//                            mlVavluechangeTime(session, operator.getName(), operator.getValue1()));
//                }
//                break;
//            case Constant.ACTION_NAME_KQJR:
//            case Constant.ACTION_NAME_TZJR:
//            case Constant.ACTION_NAME_KQJR_1:
//            case Constant.ACTION_NAME_KQJR_2:
//            case Constant.ACTION_NAME_KQJR_3:
//            case Constant.ACTION_NAME_KQJR_4:
//            case Constant.ACTION_NAME_KQJR_5:
//            case Constant.ACTION_NAME_KQJR_6:
//            case Constant.ACTION_NAME_KQJR_7:
//            case Constant.ACTION_NAME_KQJR_8:
//                //加热
//                data = CmdList.actionJR(operator.getValue(), operator.getValue1());
//                break;
//            case Constant.ACTION_NAME_GSGZ:
//            case Constant.ACTION_NAME_DKGZ:
//                //抽风
//                data = CmdList.actionGg(operator.getValue());
//                break;
//            case Constant.ACTION_NAME_CC:
//                //抽风
//                data = CmdList.actionCc(operator.getValue());
//                break;
//            case Constant.ACTION_NAME_KSJB:
//            case Constant.ACTION_NAME_TZJB:
//                //搅拌
//                if (operator.getValue() > 3) {
//                    data = CmdList.actionJb(3);
//                } else {
//                    data = CmdList.actionJb(operator.getValue());
//                }
//                break;
//            case Constant.ACTION_NAME_JSC:
//                //加食材
//                if (operator.getValue() <= 4 && operator.getValue() >= 0) {
//                    data = CmdList.actionJsc(operator.getValue(), operator.getValue1());
//                }
//                break;
//            case Constant.ACTION_NAME_FW:
//                //复位
//                data = CmdList.actionFw(operator.getValue(), operator.getValue1());
//                break;
//        }
//        return data;
//    }
//
//    public static int mlVavluechangeTime(Session session, String type, int value) {
//        float temp = 1f;
//        Log.e(TAG,"type="+type+" value="+value);
//        try {
//            temp = (float) value / Float.parseFloat(session.getString(type, "1"));
//        } catch (Exception e) {
//            Log.e(TAG,e.getMessage());
//        }
//        Log.e(TAG, " 转换后的值:" + (int) Math.ceil(temp) + "temp=" + temp);
//        return (int) Math.ceil(temp);
//    }

}
